package com.xiaohudie.CompressPicture;

/**
 * @Author xiao hu die
 * @Date 2022/2/28 14:34
 * @Version 1.0
 */

import net.coobird.thumbnailator.Thumbnails;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

/**压缩图片*/
public class Test01 {
    public static void main(String[] args) {
        try {
            Thumbnails.of(new File("D:\\100000.png"))
                    .scale(0.5f)
                    .outputQuality(0.5f)
                    .toOutputStream(new FileOutputStream("D:\\1000001.png"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
